package StudyCode.summary.Basic.numberformat;

import java.text.DecimalFormat;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class FormatCustom1 {
	public static void main(String[] args) {
		customFormat("###,###.###", 123456.789);
		customFormat("###.##", 123456.789);
		customFormat("000000.000", 123.78);
		customFormat("$###,###.###", 12345.67);
	}

	public static void customFormat(String pattern, double value) {
		DecimalFormat myFormatter = new DecimalFormat(pattern);
		String output = myFormatter.format(value);
		System.out.println(value + "  " + pattern + "  " + output);
	}
}
